import jwt
import datetime

class mytoken():
    def encode_jwt(self,id,time,myword):
        info={
            "exp":int((datetime.datetime.now()+datetime.timedelta(seconds=time)).timestamp()),
            "uid":id
        }
        jwt_token = jwt.encode(info,myword,algorithm="HS256")
        return jwt_token

    def decode_jwt(self,token,myword):
        res = jwt.decode(token,myword,algorithms="HS256")
        return res

token1 = mytoken()
# print(token1.encode_jwt(1,60,"123"))
# print(token1.decode_jwt("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2Mzk3MzUxOTcsInVpZCI6MX0.udSflXkBoQR3waam_0nCg1hAjinbCpafCrC9Iz780LI","123"))
